Interface sbktech.tools.hashjava.bytecode.Obfuscator
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface sbktech.tools.hashjava.bytecode.Obfuscator

public interface Obfuscator
extends Object
The Obfuscater is used to perform renaming of symbols. Various implementations of this interface can choose to use different renaming schemes, or selectively rename classes from the environment.

How does this work? After you've added all the classes into an Environment and called obfuscate() in it, the environment calls this interface with a ClassInfo instance for every class in the environment.

As you get each ClassInfo, peek and modify the modifiable symbols with the definedFields() and definedMethods() methods in ClassInfo. The general structure of any obfuscator implementation would probably look like


public obfuscate(ClassInfo cinfo)
{
  if (<This class should not be altered>) return;
  if (<class name should be changed>)
     cinfo.rename(<new name>);
  if (<fields should be changed>)
  {
    Modifiable mods[] = cinfo.definedFields();
    for (int i=0; i<mods.length; i++)
    {
       mods[i].rename(<new name>);
    }
  }
  if (<methods should be changed>)
  {
    Modifiable mods[] = cinfo.definedMethods();
    for (int i=0; i<mods.length; i++)
    {
       mods[i].rename(<new name>);
    }
  }
}

Author:
$Author: kbs $
See Also:
Modifiable, ClassInfo

Method Index

 o obfuscate(ClassInfo)
Obfuscator implementations should implement this method to enable various renaming schemes.

Methods

 o obfuscate
  public abstract void obfuscate(ClassInfo cinfo)
Obfuscator implementations should implement this method to enable various renaming schemes.
Parameters:
cinfo - This contains the class to be handled. The Environment calls this method once for each class that needs to be obfuscated.

All Packages  Class Hierarchy  This Package  Previous  Next  Index